<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="iOS开发," />





  <link rel="alternate" href="/atom.xml" title="尛孟的博客" type="application/atom+xml" />






<meta name="description" content="沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择  先来了解每一个文件夹的基本作用    • Documents：保存应用运行时生成的需要持久化的数据，iTunes同步设备时会备份该目录。• tmp：保存应用运行时所需的临时数据，使用完毕后再将相应的文件从该目录删除。应用没有运行时，系统也可能会清除该目录下的文件。iTune">
<meta name="keywords" content="iOS开发">
<meta property="og:type" content="article">
<meta property="og:title" content="沙盒文件夹的作用和选择">
<meta property="og:url" content="http://yoursite.com/2016/04/18/沙盒文件夹的作用和选择/index.html">
<meta property="og:site_name" content="尛孟的博客">
<meta property="og:description" content="沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择  先来了解每一个文件夹的基本作用    • Documents：保存应用运行时生成的需要持久化的数据，iTunes同步设备时会备份该目录。• tmp：保存应用运行时所需的临时数据，使用完毕后再将相应的文件从该目录删除。应用没有运行时，系统也可能会清除该目录下的文件。iTune">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-01-09T03:56:54.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="沙盒文件夹的作用和选择">
<meta name="twitter:description" content="沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择  先来了解每一个文件夹的基本作用    • Documents：保存应用运行时生成的需要持久化的数据，iTunes同步设备时会备份该目录。• tmp：保存应用运行时所需的临时数据，使用完毕后再将相应的文件从该目录删除。应用没有运行时，系统也可能会清除该目录下的文件。iTune">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"hide","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: 'ZNJ0RM31SP',
      apiKey: '9fae47ade11c769ab25bba4061522c1d',
      indexName: 'for_meng',
      hits: {"per_page":10},
      labels: {"input_placeholder":"输入关键词进行搜索","hits_empty":" 找不到关于 ”${query}“ 的文章 ","hits_stats":" 共找到${hits} 篇文章,花了${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2016/04/18/沙盒文件夹的作用和选择/"/>




<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
<link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">


  <title>沙盒文件夹的作用和选择 | 尛孟的博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">尛孟的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">想法总是无法付诸实践…</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2016/04/18/沙盒文件夹的作用和选择/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="尛孟">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="尛孟的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">沙盒文件夹的作用和选择</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-04-18T18:56:00+08:00">
                2016-04-18
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/iOSDevelopment/" itemprop="url" rel="index">
                    <span itemprop="name">iOS开发</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/iOSDevelopment/Native/" itemprop="url" rel="index">
                    <span itemprop="name">原生应用</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          
             <span id="/2016/04/18/沙盒文件夹的作用和选择/" class="leancloud_visitors" data-flag-title="沙盒文件夹的作用和选择">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <hr>
<blockquote>
<h6 id="沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择"><a href="#沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择" class="headerlink" title="沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择"></a>沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择</h6></blockquote>
<hr>
<h6 id="先来了解每一个文件夹的基本作用"><a href="#先来了解每一个文件夹的基本作用" class="headerlink" title="先来了解每一个文件夹的基本作用"></a>先来了解每一个文件夹的基本作用</h6><blockquote>
<p>   • Documents：保存应用运行时生成的需要持久化的数据，iTunes同步设备时会备份该目录。<br>• tmp：保存应用运行时所需的临时数据，使用完毕后再将相应的文件从该目录删除。应用没有运行时，系统也可能会清除该目录下的文件。iTunes同步设备时不会备份该目录<br>• Library/Caches：保存应用运行时生成的需要持久化的数据，iTunes同步设备时不会备份该目录。一般存储体积大、不需要备份的非重要数据<br>• Library/Preference：保存应用的所有偏好设置，iOS的Settings(设置)应用会在该目录中查找应用的设置信息。iTunes同步设备时会备份该目录</p>
<h6 id="（看完还是不知道到底存哪里比较好啊喂-╯’-‘-╯︵-┻━┻-）"><a href="#（看完还是不知道到底存哪里比较好啊喂-╯’-‘-╯︵-┻━┻-）" class="headerlink" title="（看完还是不知道到底存哪里比较好啊喂(╯’ - ‘)╯︵ ┻━┻ ）"></a>（看完还是不知道到底存哪里比较好啊喂(╯’ - ‘)╯︵ ┻━┻ ）</h6></blockquote>
<hr>
<blockquote>
<h6 id="–-Documents"><a href="#–-Documents" class="headerlink" title="– Documents"></a>– Documents</h6><p>– 需要保存由”应用程序本身”产生的文件或者数据，例如：游戏进度、涂鸦软件的绘图信息<br>– 目录中的文件会被自动保存在 iClioud<br>– 注意 ： 不要保存从网络上下载的文件，否则会无法上架</p>
<hr>
<h6 id="–-Caches"><a href="#–-Caches" class="headerlink" title="– Caches"></a>– Caches</h6><p>– 保存临时文件，”后续需要使用”，例如：缓存图片、离线数据(地图数据等)<br>– 系统不会清零 cache 目录中的文件  –&gt; 因此要求程序开发时，”必须提供 cache 目录的清理解决方案”</p>
<hr>
<h6 id="–-Preference"><a href="#–-Preference" class="headerlink" title="– Preference"></a>– Preference</h6><p>– 用户偏好设置，使用 NSUserDefault 直接读写</p>
<hr>
<h6 id="–-Tmp"><a href="#–-Tmp" class="headerlink" title="– Tmp"></a>– Tmp</h6><p>– 保存临时文件，”后续不需要使用”<br>– tmp  目录中的文件，系统会自动清零<br>– 重新启动手机时，tmp  目录会被情况<br>– 系统磁盘空间不足时，系统也会自动清理</p>
</blockquote>
<hr>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/iOS开发/" rel="tag"># iOS开发</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/04/17/代理:通知:KVO 的区别/" rel="next" title="代理/通知/KVO 的区别">
                <i class="fa fa-chevron-left"></i> 代理/通知/KVO 的区别
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/01/09/html中的文本级:容器级标签与css中的块级:行内元素/" rel="prev" title="html中的文本级/容器级标签与css中的块级/行内元素">
                html中的文本级/容器级标签与css中的块级/行内元素 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">尛孟</p>
              <p class="site-description motion-element" itemprop="description">与人联系甚少</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">13</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-6"><a class="nav-link" href="#沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择"><span class="nav-number">1.</span> <span class="nav-text">沙盒大家都知道，但是平时要存储数据时总不知道存到哪里去才是正确的选择，这次就来聊聊每一个文件夹的作用和使用时该怎么选择</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#先来了解每一个文件夹的基本作用"><span class="nav-number">2.</span> <span class="nav-text">先来了解每一个文件夹的基本作用</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#（看完还是不知道到底存哪里比较好啊喂-╯’-‘-╯︵-┻━┻-）"><span class="nav-number">3.</span> <span class="nav-text">（看完还是不知道到底存哪里比较好啊喂(╯’ - ‘)╯︵ ┻━┻ ）</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#–-Documents"><span class="nav-number">4.</span> <span class="nav-text">– Documents</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#–-Caches"><span class="nav-number">5.</span> <span class="nav-text">– Caches</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#–-Preference"><span class="nav-number">6.</span> <span class="nav-text">– Preference</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#–-Tmp"><span class="nav-number">7.</span> <span class="nav-text">– Tmp</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">尛孟</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.4"></script>



  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("KhsxPkrt4UYiKBnwYFY9zUTN-gzGzoHsz", "a1zezRocQqcmPxlFVdXKrhz9");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  

  

  

  

</body>
</html>
